<?php

/**
 * Created by PhpStorm.
 * User: xuke
 * Date: 16/7/13
 * Time: 下午2:54
 */
namespace App\Http\Controllers\Admin\System;
use App\Http\Controllers\Admin\AdminBaseController;
use Hash;
use Auth;
use App\Http\Model\Admin AS AdminModel;
use Illuminate\Http\Request;
use Redirect;

class LoginController extends AdminBaseController
{
    public function index()
    {
        return view('Login/login', ['name' => 'James']);
    }

    public function login(Request $request)
    {
        $username = $request->input('username');
        $password = $request->input('password');
        if (Auth::guard('web')->attempt(['user' => $username, 'password' => $password]))
        {
            return redirect()->intended('admin/user/user');
        }else{
            print_r(['user' => $username, 'password' => $password]);
        }
    }
    
    public function logout()
    {
        Auth::guard('web')->logout();
        Redirect::to('admin/login/login');
    }
}